package com.schooldate.model.service.impl;

import com.schooldate.base.BaseSupportImpl;
import com.schooldate.model.entity.PraiseRecord;
import com.schooldate.model.service.PraiseRecordService;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by etund on 2015/4/1 0001.
 */
@Service
@Transactional
@SuppressWarnings("all")
public class PraiseRecordServiceImpl extends BaseSupportImpl<PraiseRecord> implements PraiseRecordService {

    @Override
    public PraiseRecord getByUserIdAndMessageBoardId(Long uid, Long mid) {
        list = this.getSession().createCriteria(PraiseRecord.class)
                       .add(Restrictions.eq("userId",uid))
                        .add(Restrictions.eq("messageBoardId",mid))
                        .list();
        if (list.size()>0)
            return list.get(0);
        return null;
    }
}
